package dao

import (
	"server/basic/config"
	"server/basic/model"
)

func UserWhere(name string) (user model.Users, err error) {
	err = config.DB.Where("name=?", name).Find(&user).Error
	if err != nil {
		return model.Users{}, err
	}
	return user, err
}

func UserRegister(name string, mobile string, password string) (user model.Users, err error) {
	user = model.Users{

		Name:     name,
		Mobile:   mobile,
		Password: password,
	}
	err = config.DB.Create(&user).Error
	if err != nil {
		return model.Users{}, err
	}
	return user, err
}
